﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SyndicateDAO.DatabaseObject;

namespace SyndicateBusiness.Classes
{
    public class BusinessFacade
    {
        public CouponBL CouponBL = new CouponBL();
       
        public DrawBL DrawBL = new DrawBL();
        public EventLogBL EventLogBL = new EventLogBL();
        public FundsLogBL FundsLogBL = new FundsLogBL();
        public LineBL LineBL = new LineBL();
        public PlayerBL PlayerBL = new PlayerBL();
        public ResultBL ResultBL = new ResultBL();
        public SyndicateBL SyndicateBL = new SyndicateBL();
       
        public UserBL UserBL = new UserBL();


        public syndicate CurrentSyndicate
        {
        get
        {
            try
            {

                if (System.Web.HttpContext.Current.Session["CurrentSyndicateId"] != null)
                    return
                        SyndicateBL.GetSingle(
                            Int32.Parse(System.Web.HttpContext.Current.Session["CurrentSyndicateId"].ToString()));
                else
                {
                    syndicate cs = SyndicateBL.GetCurrentSyndicate();
                    System.Web.HttpContext.Current.Session["CurrentSyndicateId"] = cs.id;

                    return cs;

                }
            }
            catch
            {
                return SyndicateBL.GetCurrentSyndicate();
            }


        }
            
        }
    }
}
